Occurs when the browser needs to be resized during playback. This can happen due to a SIZE or any kind of screenshot command
in the macro, like SAVEAS or IMAGESEARCH. The Size property of BrowserResizeEventArgs contains
the required size that iMacrosControl should be set.
Namespace: iMacros.Component
Assembly: iMacros.Component (in iMacros.Component.dll) Version: 12.0.501.6698
Syntax
Value
Type: iMacros.Component.EventHelpersBrowserResizeEventHandlerExamples
using System; using System.Windows.Forms; using iMacros.Component; public partial class MainForm : Form { private iMacrosControl iim; public MainForm() { InitializeComponent(); iim = iMacrosControl.Create("xxxx") // Use here the license key for iMacros.Component iim.Dock = DockStyle.Fill; browserPane.Controls.Add(iim); } private void play_Click(object sender, EventArgs e) { if (iim == null) return; // Take care that the player is in idle mode before starting to play a macro if (iim.PlayerMode != PlaybackModes.Idle) return; // Subscribe to events which are fired during playback iim.BrowserResize += iim_BrowserResize; string macro = "CODE:URL GOTO=http://forum.imacros.net/" + Environment.NewLine; macro += "SAVEAS TYPE=PNG FOLDER=* FILE=forum.png"; int res = iim.Play(macro); // Detach the player events iim.BrowserResize -= iim_BrowserResize; if (res == 0) // res == 0 means that the player was in playing mode when Play was called. MessageBox.Show("Player is still playing"); MessageBox.Show(String.Format("Play result is {0}", iim.ErrorText); } private void iim_BrowserResize(object sender, BrowserResizeEventArgs e) { // Handle the BrowserResize event when iMacros Player requests the // browser to be resized (due to a SIZE command, for instance) // Get the the current size of iMacros control var oldSize = iim.Size; // Check if it needs to be adjusted if (oldsize != e.Size) { // Resize the form Width += e.Size.Width - oldSize.Width; Height += e.Size.Height - oldSize.Height; } // Let the form resize Application.DoEvents(); } }
See Also